#version 120
uniform vec3 modelpos;
uniform float modelrot;
uniform mat4 projectionMatrix;
varying vec3 col;

mat3 rotationMatrixAroundZ(in float angle)
{
	return mat3(
			cos(angle),-sin(angle),0.0, 
			sin(angle),cos(angle),0.0,
			0.0,0.0,1.0);
}

mat3 rotationMatrixAroundY(in float angle)
{
	return mat3(
			cos(angle ),0,-sin(angle),
			0.0,1.0,0.0,							
			sin(angle),0.0,cos(angle));		
}

void main()
{
	mat3 rotMat1 = rotationMatrixAroundZ(modelrot);
	mat3 rotMat2 = rotationMatrixAroundY(modelrot*0.7);

	vec3 pos = rotMat2 * rotMat1 * (rotMat1*gl_Vertex.xyz + modelpos);

//	gl_Position = (vec4(pos,1.0) +vec4(0.0,0.0,0.2,0.0));
	gl_Position = projectionMatrix * (vec4(pos,1.0) +vec4(0.0,0.0,1.2,0.0));
	col = gl_Color.rgb;										
}                                          				

